<?php

namespace App\Http\Controllers\Frontend\V1;

use app\common\controller\Backend;

class Mtac extends Backend
{
    public function index()
    {
        $mutual_topic_answer = MutualTopicAnswerCommentLike::with(['comment:id,title,content,topic_id,member_id,created_at',
            'answer.member:id,nickname,avatar,member_at'])
            ->where(['member_id' => $this->memberId])
            ->get()
            ->loadMorphCount('answer', [
                MutualTopicAnswer::class => ['like', 'favorite', 'comment']
            ]);
        return $this->success('获取成功', $mutual_topic_answer);
    }

    public function store($id)
    {
        $mutual_topic_answer_comment = MutualTopicAnswerComment::find($id);
        if (!$mutual_topic_answer_comment)
        {
            return $this->error('评论已删除');
        }

        $result = MutualTopicAnswerCommentLike::where(['member_id' => $this->memberId, 'comment_id' => $mutual_topic_answer_comment->id])->first();

    }
}
